package com.tianhui.consignortwofei.mvp.model;

import android.content.Context;

import com.fgs.common.CommonModel;
import com.fgs.common.api.CommonConfig;
import com.fgs.common.progress.ObserverResponseListener;
import com.tianhui.consignortwofei.api.OrderApiService;
import com.tianhui.consignortwofei.mvp.model.enty.insure.InsureQueryInfo;

import java.util.Map;

import io.reactivex.ObservableTransformer;

/**
 * @author fgs
 * @date 2020/9/24
 * @description
 **/
public class InsureModel<T> extends CommonModel<T> {
    /**
     * 投保类型列表
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void insureTypeListModel(Context context, boolean isDialog,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).insureTypeList(), observerListener, transformer, isDialog, true);
    }

    /**
     * 投保信息查询
     *
     * @param context
     * @param isDialog
     * @param map
     * @param transformer
     * @param observerListener
     */
    public void insureQueryModel(Context context, boolean isDialog, Map<String, String> map,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).insureQuery(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 投保明细
     *
     * @param context
     * @param isDialog
     * @param insureQueryInfo
     * @param transformer
     * @param observerListener
     */
    public void insureInfoModel(Context context, boolean isDialog, InsureQueryInfo insureQueryInfo,
                                ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).insureInfo(insureQueryInfo), observerListener, transformer, isDialog, true);
    }


    /**
     * 更改发货地址和到货地址
     *无定金
     * @param context
     * @param isDialog
     * @param map
     * @param transformer
     * @param observerListener
     */
    public void changeDressAll(Context context, boolean isDialog, Map<String, String> map,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).changeDressAll(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 更改发货地址和到货地址
     *有定金
     * @param context
     * @param isDialog
     * @param map
     * @param transformer
     * @param observerListener
     */
    public void changeDressAllDingjin(Context context, boolean isDialog, Map<String, String> map,
                               ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).changeDressAllDingjin(map), observerListener, transformer, isDialog, true);
    }



}
